package day06;

import java.util.Random;
import java.util.Scanner;

public class HomeWork {
    public static void main(String[] args) {

        say();
        say("zhangsan");
        say("lisi",23);

        int a = sun(10,20);
        System.out.println(a);


        int[] d =generateArray(5,10);
        System.out.println("数组的长度："+d.length);
        for (int i=0;i<d.length;i++){
            System.out.println(d[i]);
        }

        int[] e = generateArray(8,20);
        System.out.println("第一个元素的值为："+e[0]);
        for (int i=0;i<=e.length;i++){
            System.out.println(e[i]);
        }




    }

    //无参无返回值
    public static void say(){
        System.out.println("大家好，我叫xxx");
    }
    public static void say(String name){
        System.out.println("大家好，我是"+name);
    }
    public static void say(String name,int age){
        System.out.println("大家好，我是"+name+"今年"+age);
    }
    //有参有返回值：
    public static int sun(int num1,int num2){
        int num = num1+num2;
        return num;
    }
    public static int[] generateArray(int len,int max){
        Random rand = new Random();
        int[] arr =new int[len];
        for (int i=0;i<arr.length;i++){
            arr[i] = rand.nextInt(max+1);
        }
        return arr;
    }





}
